unit uSelectTemp;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics, cxControls, cxLookAndFeels,
  cxLookAndFeelPainters, cxContainer, cxEdit, dxSkinsCore, dxSkinBlack,
  dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
  dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
  dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
  dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins,
  dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
  dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
  dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinPumpkin, dxSkinSeven,
  dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
  dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
  dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
  dxSkinXmas2008Blue, Data.DB, cxTextEdit, cxMaskEdit, cxDropDownEdit,
  cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox, cxGroupBox, cxLabel,
  Vcl.Menus, Vcl.StdCtrls, cxButtons, Vcl.ActnList;

type
  TFrmSelectTemp = class(TForm)
    dsTmpl: TDataSource;
    cxGroupBox1: TcxGroupBox;
    cxLookupComboBox1: TcxLookupComboBox;
    cxLabel1: TcxLabel;
    ActionList1: TActionList;
    actOK: TAction;
    actCancel: TAction;
    cxButton14: TcxButton;
    cxButton13: TcxButton;
    procedure actCancelExecute(Sender: TObject);
    procedure actOKExecute(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    tmpId:string;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmSelectTemp: TFrmSelectTemp;
  function FrmSelectTempShow(tmplType:string):string;
implementation

{$R *.dfm}

uses uDm, ucommFunction;

function FrmSelectTempShow(tmplType:string):string;
begin
  Application.CreateForm(TFrmSelectTemp,FrmSelectTemp);
  with FrmSelectTemp do
  begin
    tmpId:='';
    dsTmpl.DataSet.Filtered:=False;
    dsTmpl.DataSet.Filter:='TEMP_TYPE='+QuotedStr(tmplType);
    dsTmpl.DataSet.Filtered:=True;
    if ShowModal=mrOK then
    begin
      Result:=tmpId;
    end;
  end;
end;

procedure TFrmSelectTemp.actCancelExecute(Sender: TObject);
begin
  Self.ModalResult:=mrCancel;
end;

procedure TFrmSelectTemp.actOKExecute(Sender: TObject);
begin
  tmpId:=VarToStr(cxLookupComboBox1.EditValue);
  Self.ModalResult:=mrOk;
end;

procedure TFrmSelectTemp.FormCreate(Sender: TObject);
begin
  pSetCaption(Self);
end;

end.
